<?php

class Front_Base {
    /*private $dependence = array(
        'Front_Control_List_Base'
    );

    private $script = "
        alert('test');
    ";*/

    public function append(&$scripts){
        $thisClassName = get_class($this);
        if(!in_array($thisClassName, $scripts['script_names'])){
            $scripts['script_names'][] = $thisClassName;
            $scripts['scripts'] = "\n<script id='" . $thisClassName . "'>" . $this->script . "\n</script>" . $scripts['scripts'];
        }
        foreach($this->dependence as $classScriptBuilder){
            $scriptBuilder = new $classScriptBuilder();
            $scriptBuilder->append($scripts);
        }
    }
}